package com.axon.dataservices.helpers
{
	import org.restfulx.collections.ModelsCollection;
	import org.restfulx.utils.RxUtils;
	
	public class AxDSUtils
	{
		//////////////////////////////////////////////////////////////////////////////////////////////////////
		
    	public static function clone(object: Object): Object 
    	{
    		return RxUtils.clone(object);
    	}

		//////////////////////////////////////////////////////////////////////////////////////////////////////
		
    	public static function replaceModelCollectionItem(modelCollection: ModelsCollection, oldModel: Object, newModel: Object) : int 
    	{
    		var i: int = modelCollection.getItemIndex(oldModel);
    		
    		if ( i != -1 ) {
    			
    			modelCollection.removeItemAt( i );
    			modelCollection.addItemAt(newModel, i);
    		}
    		
    		return i;
    	}

	}
}